package com.geek.tutorial.itext.text;

import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Chunk;
import com.lowagie.text.Font;
import com.lowagie.text.Phrase;
import java.awt.Color;
import java.io.FileOutputStream;

public class Chunk_Example {
	
	public Chunk_Example() throws Exception{
		
		Document document = new Document();
		PdfWriter.getInstance(document, new FileOutputStream("chunk_example.pdf"));
		document.open();
		
		Font font = new Font(Font.COURIER, 10, Font.BOLD); // 1
		font.setColor(new Color(0x92, 0x90, 0x83));
		
		Chunk chunk = new Chunk("testing text element", font); // 2
		
		chunk.setBackground(new Color(0xff, 0xe4, 0x00)); // 3

		document.add(chunk); // 4
		document.close();
		
	}

	public static void main(String[] args) {
		try{
			Chunk_Example textExample = new Chunk_Example();
		}catch(Exception e){
			System.out.println(e);
		}
	}
}